<?php
$shuiguo=[
    ['name'=>'香蕉','num'=>2,'price'=>'7.99'],
    ['name'=>'苹果','num'=>1,'price'=>'6.89'],
    ['name'=>'橘子','num'=>3,'price'=>'3.99']
];

$total=0;
$str='<title>商品订货单</title>';
$str='<table border="1" cellpadding"1" cellspacing="0">';
$str.='<tr><td>商品名称</td><td>购买数量（斤）</td><td>商品价格（元/斤）</td></tr>';
foreach($shuiguo as $values){
    $str.='<tr>';
    foreach($values  as $v){
        $str.='<td>'.$v.'</td>';
    }
    $sum=$values['price']*$values['num'];
    $ZHEKOU=0.8;
    $str.='</tr>';
    $total +=$sum*$ZHEKOU;
}
$str.='<tr><td colspan="3">商品折扣:'.$ZHEKOU.'</tr></td>';
$str.='<tr><td colspan="3">商品总价：'.$total.'元</td></tr></table>';
echo $str;